<form action="<?php echo $this->url(); ?>" method="POST">
    <?php if (isset($this->item)) : ?>
	<h1><?php echo $this->translate('Edit user'); ?></h1>
	<?php else: ?>
	<h1><?php echo $this->translate('Add user'); ?></h1>
	<?php endif; ?>
	<table class="form" style="border: 1px Lightid #134385;">
		<tr>
		    <td>
		        <label><?php echo $this->translate('Name'); ?></label>
		        <input type="text" name="name" value="<?php echo (isset($this->data['name']) ? $this->data['name'] : ''); ?>" />
		        <?php if (isset($this->errors['name']) && $this->errors['name']) : ?>
		        <ul class="errors"><li><?php echo $this->errors['name']; ?></li></ul>
		        <?php endif; ?>
		    </td>
	    </tr>
	    <tr>
		    <td>
		        <label><?php echo $this->translate('Group'); ?></label>
		        <select name="groupId">
		        <?php foreach ($this->groups as $group) : ?>
		            <option value="<?php echo $group->id; ?>"<?php echo (isset($this->data['groupId']) && $group->id == $this->data['groupId'] ? ' selected' : ''); ?>><?php echo $group->name; ?></option>
		        <?php endforeach; ?>
		        </select>
		        <?php if (isset($this->errors['groupId']) && $this->errors['groupId']) : ?>
		        <ul class="errors"><li><?php echo $this->errors['groupId']; ?></li></ul>
		        <?php endif; ?>
		    </td>
	    </tr>
	    <tr>
		    <td>
		        <label><?php echo $this->translate('Password'); ?></label>
		        <input type="password" name="password" value="" />
		        <?php if (isset($this->errors['password']) && $this->errors['password']) : ?>
		        <ul class="errors"><li><?php echo $this->errors['password']; ?></li></ul>
		        <?php endif; ?>
		    </td>
	    </tr>
	    <tr>
		    <td>
		        <label><?php echo $this->translate('Firstname'); ?></label>
		        <input type="text" name="firstName" value="<?php echo (isset($this->data['firstName']) ? $this->data['firstName'] : ''); ?>" />
		        <?php if (isset($this->errors['firstName']) && $this->errors['firstName']) : ?>
		        <ul class="errors"><li><?php echo $this->errors['firstName']; ?></li></ul>
		        <?php endif; ?>
		    </td>
	    </tr>
	    <tr>
		    <td>
		        <label><?php echo $this->translate('Middlename'); ?></label>
		        <input type="text" name="middleName" value="<?php echo (isset($this->data['middleName']) ? $this->data['middleName'] : ''); ?>" />
		        <?php if (isset($this->errors['middleName']) && $this->errors['middleName']) : ?>
		        <ul class="errors"><li><?php echo $this->errors['middleName']; ?></li></ul>
		        <?php endif; ?>
		    </td>
	    </tr>
	    <tr>
		    <td>
		        <label><?php echo $this->translate('Lastname'); ?></label>
		        <input type="text" name="lastName" value="<?php echo (isset($this->data['lastName']) ? $this->data['lastName'] : ''); ?>" />
		        <?php if (isset($this->errors['lastName']) && $this->errors['lastName']) : ?>
		        <ul class="errors"><li><?php echo $this->errors['lastName']; ?></li></ul>
		        <?php endif; ?>
		    </td>
	    </tr>
	</table>
	<input type="submit" id="back" style="margin-left: 10px" value="<?php echo $this->translate('Back to list'); ?>" />
	<?php if (isset($this->item)) : ?>
	<input type="submit" style="margin-left: 10px" name="apply" value="<?php echo $this->translate('Apply'); ?>" />
	<?php endif; ?>
	<input type="submit" name="save" value="<?php echo $this->translate('Save'); ?>" />
</form>
<script type="text/javascript">
//<![CDATA[
$(document).ready(function () {
    $('#back').click(function () {
    	window.location.href = '<?php echo $this->url(array('action' => 'index', 'id' => null)); ?>';
    	return false;
	});
});
//]]>
</script>